@{
  Random rnd = new Random();
    Layout="_LayoutBase";
    var published = Model.Get<DateTime>(BlogKeys.Published);         
    var lead = Model.String(BlogKeys.Lead);
    var tags = Model.Get<string[]>(BlogKeys.Tags) ?? new string[] {};
    var image = Model.Get<string>(BlogKeys.Image) ?? "/assets/images/background.jpg";
      var nextPost = Documents[Blog.BlogPosts].OrderBy(p => p.Get<DateTime>(BlogKeys.Published)).SkipWhile(x => !x.Source.Equals(Model.Source)).Skip(1).FirstOrDefault();
        var nextPostImage = string.Empty;
        if(nextPost != null){
          nextPostImage = nextPost.Get<string>(BlogKeys.Image) ?? "/assets/images/background.jpg";
        }
}
<article>

  <header class="section-padding--lg mast rellax" data-rellax-speed="-4">
    <a class="nav nav--white" href="@Context.GetLink("/")">
      <i class="fa fa-lg fa-arrow-left"></i>
      <span>Back to Posts</span>
    </a>
    <figure class="absolute-bg mast__img" style="background-image: url('@image');"></figure>
    <div class="mast__container">
      <span><time datetime="@published.ToString("YYYY-MM-DD")">@(published.ToLongDateString(Context))</time></span>
       <h1>@Model.WithoutSettings.String(BlogKeys.Title)</h1>   
        @if(!string.IsNullOrWhiteSpace(lead))
        {
            <h3>@lead</h3>
        } 
      @if(tags.Any())
      {
        bool first = true;
        <span>
          @foreach (string tag in tags.OrderBy(x => x))
            {
                IDocument tagDocument = Documents[Blog.Tags].FirstOrDefault(x => x.String(BlogKeys.Tag) == tag && x.Get<int>(Keys.CurrentPage) == 1);
                if(!first)
                {
                  <text>,</text>
                }
                first = false;
                if(tagDocument != null)
                {                
                    <a class="nav--white" href="@Context.GetLink(tagDocument)">@tag</a>
                }
            }
        </span>
      }
    </div>
  </header>
  <section class="section-padding bg-grey">
    <div class="post">
      @RenderBody() 
    </div>
          
  </section>

</article>
@if(nextPost != null){
 <section class="next">
    <a class="next__link" href="@Context.GetLink(nextPost)" style="background-image: url('@nextPostImage');">
      <div class="next__container">
        <span>Read Next</span>
        <h2>@nextPost.WithoutSettings.String(BlogKeys.Title)</h2>
      </div> 
    </a>
  </section>
}

@Html.Partial("_PageFooter", false)